package top.jacktgq.candychat.utils;


import org.apache.commons.codec.binary.Base64;

import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @Author CandyWall
 * @Date 2021/2/8--18:21
 * @Description 对字符串进行MD5加密
 */
public class MD5Utils {
    public static String getMD5Str(String strValue) {
        try {
            return Base64.encodeBase64String(MessageDigest.getInstance("MD5").digest(strValue.getBytes(StandardCharsets.UTF_8)));
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}
